﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>绿色供应链管理系统 - 登录</title>
    <meta name="keywords" content="绿色供应链管理系统 - 登录">
    <meta name="description" content="绿色供应链管理系统 - 登录">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="/resources/css/bootstrap.min.css" rel="stylesheet">
    <link href="/resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/resources/css/animate.min.css" rel="stylesheet">
    <link href="/resources/css/style.min.css" rel="stylesheet">
    <link href="/resources/css/login.min.css" rel="stylesheet">
    <script>
        if (window.top !== window.self) { window.top.location = window.location };
    </script>
</head>
<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">
                    <div class="logopanel m-b">
                        <h1>GSCM</h1>
                    </div>
                    <div class="m-b"></div>
                    <h4>欢迎使用 <strong>绿色供应链管理系统</strong></h4>
                    <ul class="m-b">
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势一</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势二</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势三</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势四</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势五</li>
                    </ul>
                    <strong>还没有账号？ <a href="~/Login/Register">立即注册&raquo;</a></strong>
                </div>
            </div>
            <div class="col-sm-5">
                <form method="post">
                    <h4 class="no-margins">登录：</h4>
                    <p class="m-t-md">登录到绿色供应链系统</p>
                    <input type="text" id="txt_Phone" class="form-control uname" placeholder="电话">
                    <input type="password" id="txt_Password" class="form-control pword m-b" placeholder="密码">
                    <a href="#">忘记密码了？</a>
                    <button type="button" id="btn_login" class="btn btn-success btn-block">登 录</button>
                </form>
            </div>

            @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
            @functions{
                public string GetAntiXsrfRequestToken()
                {
                    return Xsrf.GetAndStoreTokens(Context).RequestToken;
                }
            }
            <script>
                 var csrfToken = '@GetAntiXsrfRequestToken()';
            </script>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 2021 All Rights Reserved. ZSon
            </div>
        </div>
    </div>
    <script src="/resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="/resources/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/resources/js/plugins/layer/layer.min.js"></script>
    <script>
        (function (window, document, $) {
            $.ajaxSetup({
                headers: {
                    'RequestVerificationToken': csrfToken
                }
            });
        })(window, document, jQuery);
        function dcTips(msg, time, icon) {
            layer.msg(msg, {
                icon: icon,
                time: time,
                tips: [3, "red"]
            });
        }

        $("#btn_login").click(function () {
            var txt_phone = $("#txt_Phone").val();
            var txt_pwd = $("#txt_Password").val();
            if (txt_phone.length < 1) {
                layer.tips("请输入手机号", $("#txt_Phone"), { tips: [3, "red"] });
                return false;
            }
            if (txt_pwd.length < 1) {
                layer.tips("请输入密码", $("#txt_Password"), { tips: [3, "red"] });
                return false;
            }

            $.post('@Url.Action("Index")', { phone: txt_phone, password: txt_pwd },
                function (result) {
                    if (result.code != 0) {
                        layer.tips(result.message, $("#btn_login"), { tips: [3, "red"] });
                    $("#txt_Password").val("");
                }
                else {
                    window.location.href = result.data;
                }
            });
        });

        document.onkeydown = function (e) {
            var ev = document.all ? window.event : e;
            if (ev.keyCode == 13) {
                $("#btn_login").click();
            }
        }
    </script>
</body>
</html>
